package com.auto.learning.receiver;

import com.auto.learning.net.HttpRequestHelper;
import com.auto.learning.service.MusicPlayManager;
import com.auto.learning.view.SharedPreferencesUtils;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * 定时闹钟，关闭播放
 */
public class AlarmReceiver extends BroadcastReceiver{

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals(HttpRequestHelper.ALARM_ACTION)) {
			if (MusicPlayManager.getInstance(context).isPlaying()) {
				MusicPlayManager.getInstance(context).pause();
				SharedPreferencesUtils.setParam(context, HttpRequestHelper.M_TILE_OFF, false);
			}
		}
	}

}
